#ifndef OC_COMMAND_IN_H_
#define OC_COMMAND_IN_H_
#include "command.h"

#pragma pack(1)
namespace Cmd
{
        namespace OpenClass
        {
                //  cmd declaration
                enum
                {
                        CMDIN_LOGIN             = 0x0010,		// 登录NoticeServer验证指令
                        CMDIN_SYNC              = 0x0011,		// 转发的指令
                };
                enum
                { //CMDIN_LOGIN
                        SCMDIN_LOGIN                    = 0x0001,	// 请求登录NoticeServer
                        SCMDIN_LOGIN_RESPONCE           = 0x0002,	// 登录NoticeServer返回
                };

                enum
                {
                        SCMDIN_SYNC_OPENCLASS           = 0x0001,       // 同步公开课
                        SCMDIN_SYNC_OPENCLASS_USERS     = 0x0002,       // 同步公开课用户
                };

                //	cmd definition
                struct stLoginCmd:
                        t_NullCmd
                {
                        stLoginCmd()
                                :
                                        t_NullCmd( CMDIN_LOGIN, SCMDIN_LOGIN )
                        {
                                dest_type_ = OPENCLASSSERVER;
                                server_type_ = 0;
                                server_id_ = 0;
                        }
                        WORD dest_type_;
                        WORD server_type_;
                        DWORD server_id_;
                };
                struct stLoginResponce:
                        t_NullCmd
                {
                        stLoginResponce()
                                :
                                        t_NullCmd( CMDIN_LOGIN, SCMDIN_LOGIN_RESPONCE )
                        {
                        }
                };

                struct stSyncOpenClass:
                        t_NullCmd
                {
                        stSyncOpenClass()
                                :
                                        t_NullCmd( CMDIN_SYNC, SCMDIN_SYNC_OPENCLASS )
                        {
                                num_ = 0;
                                finish_ = 0;
                        }
                        WORD num_;
                        BYTE finish_; //是否发送结束 0-未结束 1-结束
                        struct
                        {
                                DWORD classid;          //公开课ID
                                DWORD roomid;           //房间ID
                                DWORD starttime;        //开课时间
                                DWORD endtime;          //结束时间
                                WORD reservemaxcount;   //最大预约人数
                                WORD noreservemaxcount; //最大为预约人数
                                WORD roommaxcount;      //最大房间人数
                                char openclassname[1 + MAX_OPENCLASS_NAME_SIZE];
                        } open_classes_[0];
                        DWORD getSize()
                        {
                                return sizeof( *this ) + num_ * sizeof( open_classes_[0] );
                        }
                };
                struct stSyncOpenClassUsers:
                        t_NullCmd
                {
                        stSyncOpenClassUsers()
                                :
                                        t_NullCmd( CMDIN_SYNC, SCMDIN_SYNC_OPENCLASS_USERS )
                        {
                                class_id_ = 0;
                                room_id_ = 0;
                                finish_ = 0;
                                num_ = 0;
                        }
                        DWORD class_id_;
                        DWORD room_id_;
                        BYTE finish_;
                        WORD num_;
                        DWORD users_[0];
                        DWORD getSize()
                        {
                                return sizeof( *this ) + num_ * sizeof( users_[0] );
                        }
                };

        }
        ;
        //namespace OpenClass
}
;
//namespace Cmd
#pragma pack() //pack(1)
#endif //OC_COMMAND_IN_H_
